pub trait Talk {
    fn talk(&self) {
        println!("I have something to say");
    }
}

pub struct Person {
    name: String,
    age: u32,
}

impl Talk for Person {
    fn talk(&self) {
        println!("Hi, my name is {} and I am {} years old", self.name, self.age);
    }
}

pub struct Dog {
    name: String,
    age: u32,
}

impl Talk for Dog {
    fn talk(&self) {
        println!("Woof! My name is {} and I am {} years old", self.name, self.age);
    }
}

impl Talk for String {}

fn test_traits() {
   let kankang = Person {
        name: String::from("Kankang"),
        age: 20,
    };
    kankang.talk();

    let dog = Dog {
        name: String::from("Dog"),
        age: 3,
   };
   dog.talk();

   let s = String::from("Hello");
   s.talk();
}

fn main() {
    test_traits();
}
